home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / eflibpt4.zip / DEMO / TESTING / DATA2.PAS < prev    next >
Pascal/Delphi Source File  |  1996-08-16  |  2KB  |  53 lines

  1. { Borland Pascal Extended Function Library - EFLIB (C) Johan Larsson, 1996
  2.   Testing; doubly linked data element chaining
  3.  
  4.   EFLIB IS PROTECTED BY THE COPYRIGHT LAW AND MAY NOT BE COPIED, SOLD OR
  5.   MANIPULATED. FOR MORE INFORMATION, SEE PROGRAM MANUAL! THIS DEMONSTRAT-
  6.   ION PROGRAM MAY FREELY BE USED AND DISTRIBUTED.                          }
  7.  
  8.  
  9. uses EFLIBDAT;
  10.  
  11.  
  12. var Element1, Element2 : GenericLinkageObjectPointerType;
  13.     Data1 : string[100]; Data2, Data3 : string[200];
  14.  
  15. begin
  16.      Data1 := '1) Some data to store in the element.';
  17.      Data2 := '2) Some other data to update the element with.';
  18.      Data3 := '3) Not functioning properly!'; { Should never be displayed }
  19.  
  20.      New (Element1, InitializeEmpty);
  21.      Element1^.Free;
  22.  
  23.      New (Element1, Initialize (Data1, SizeOf(Data1)));
  24.      with Element1^ do begin
  25.           Element (Data1);
  26.           WriteLn (Data1);
  27.  
  28.           Update (Data2, SizeOf(Data2));
  29.           Element (Data1);
  30.           WriteLn (Data1);
  31.  
  32.           if IsAllocated then begin
  33.              New (Element2, InitializeDuplicate (Element1));
  34.  
  35.              with Element2^ do begin
  36.                   Element (Data3);
  37.                   WriteLn (Data3);
  38.                   { Test circular attaching of element }
  39.                   AttachAfter (Element2);
  40.                   if (Element2^.Successor <> @(Element2^)) then
  41.                      WriteLn ('Not functioning properly; circular attaching not valid.');
  42.                   Detach;
  43.                   { Connect the two elements }
  44.                   AttachBefore (Element1);
  45.                   if Element2^.IsIntact then WriteLn ('Intact links!');
  46.              end;
  47.  
  48.              Element2^.Free;
  49.           end;
  50.      end;
  51.  
  52.      Element1^.Free;
  53. end.